﻿using System;
using System.Data;
using System.Data.Common;
using Hxj.Data;
using Hxj.Data.Common;

namespace Utility.Model
{

    /// <summary>
    /// 实体类Sys_Templet 。(属性说明自动提取数据库字段的描述信息)
    /// </summary>
    [Serializable]
    public class Sys_Templet : Entity
    {
        public class _
        {
            public static readonly Field All = new Field("*", "Sys_Templet");

            public static readonly Field TempID = new Field("TempID", "Sys_Templet", "TempID");

            public static readonly Field TempAppCode = new Field("TempAppCode", "Sys_Templet", "TempAppCode");

            public static readonly Field Title = new Field("Title", "Sys_Templet", "Title");

            public static readonly Field TempletDes = new Field("TempletDes", "Sys_Templet", "TempletDes");

            public static readonly Field CreateDate = new Field("CreateDate", "Sys_Templet", "CreateDate");

            public static readonly Field CreateUser = new Field("CreateUser", "Sys_Templet", "CreateUser");

            public static readonly Field IsDelete = new Field("IsDelete", "Sys_Templet", "IsDelete");

            public static readonly Field AliTempletCode = new Field("AliTempletCode", "Sys_Templet", "AliTempletCode");
        }

        private string _TempID;

        private string _TempAppCode;

        private string _Title;

        private string _TempletDes;

        private DateTime? _CreateDate;

        private string _CreateUser;

        private bool? _IsDelete;

        private string _AliTempletCode;

        public string TempID
        {
            get
            {
                return _TempID;
            }
            set
            {
                OnPropertyValueChange(_.TempID, _TempID, value);
                _TempID = value;
            }
        }

        public string TempAppCode
        {
            get
            {
                return _TempAppCode;
            }
            set
            {
                OnPropertyValueChange(_.TempAppCode, _TempAppCode, value);
                _TempAppCode = value;
            }
        }

        public string Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnPropertyValueChange(_.Title, _Title, value);
                _Title = value;
            }
        }

        public string TempletDes
        {
            get
            {
                return _TempletDes;
            }
            set
            {
                OnPropertyValueChange(_.TempletDes, _TempletDes, value);
                _TempletDes = value;
            }
        }

        public DateTime? CreateDate
        {
            get
            {
                return _CreateDate;
            }
            set
            {
                OnPropertyValueChange(_.CreateDate, _CreateDate, value);
                _CreateDate = value;
            }
        }

        public string CreateUser
        {
            get
            {
                return _CreateUser;
            }
            set
            {
                OnPropertyValueChange(_.CreateUser, _CreateUser, value);
                _CreateUser = value;
            }
        }

        public bool? IsDelete
        {
            get
            {
                return _IsDelete;
            }
            set
            {
                OnPropertyValueChange(_.IsDelete, _IsDelete, value);
                _IsDelete = value;
            }
        }

        public string AliTempletCode
        {
            get
            {
                return _AliTempletCode;
            }
            set
            {
                OnPropertyValueChange(_.AliTempletCode, _AliTempletCode, value);
                _AliTempletCode = value;
            }
        }

        public Sys_Templet()
            : base("Sys_Templet")
        {
            _TempID = Guid.NewGuid().ToString();
            _CreateDate = ConvertHelper.GetNowDateTime();
            _IsDelete = false;
        }

        public override Field[] GetPrimaryKeyFields()
        {
            return new Field[1]
            {
            _.TempID
            };
        }

        public override Field[] GetFields()
        {
            return new Field[8]
            {
            _.TempID,
            _.TempAppCode,
            _.Title,
            _.TempletDes,
            _.CreateDate,
            _.CreateUser,
            _.IsDelete,
            _.AliTempletCode
            };
        }

        public override object[] GetValues()
        {
            return new object[8]
            {
            _TempID,
            _TempAppCode,
            _Title,
            _TempletDes,
            _CreateDate,
            _CreateUser,
            _IsDelete,
            _AliTempletCode
            };
        }

        public override void SetPropertyValues(IDataReader reader)
        {
            _TempID = DataUtils.ConvertValue<string>(reader["TempID"]);
            _TempAppCode = DataUtils.ConvertValue<string>(reader["TempAppCode"]);
            _Title = DataUtils.ConvertValue<string>(reader["Title"]);
            _TempletDes = DataUtils.ConvertValue<string>(reader["TempletDes"]);
            _CreateDate = DataUtils.ConvertValue<DateTime?>(reader["CreateDate"]);
            _CreateUser = DataUtils.ConvertValue<string>(reader["CreateUser"]);
            _IsDelete = DataUtils.ConvertValue<bool?>(reader["IsDelete"]);
            _AliTempletCode = DataUtils.ConvertValue<string>(reader["AliTempletCode"]);
        }

        public override void SetPropertyValues(DataRow row)
        {
            _TempID = DataUtils.ConvertValue<string>(row["TempID"]);
            _TempAppCode = DataUtils.ConvertValue<string>(row["TempAppCode"]);
            _Title = DataUtils.ConvertValue<string>(row["Title"]);
            _TempletDes = DataUtils.ConvertValue<string>(row["TempletDes"]);
            _CreateDate = DataUtils.ConvertValue<DateTime?>(row["CreateDate"]);
            _CreateUser = DataUtils.ConvertValue<string>(row["CreateUser"]);
            _IsDelete = DataUtils.ConvertValue<bool?>(row["IsDelete"]);
            _AliTempletCode = DataUtils.ConvertValue<string>(row["AliTempletCode"]);
        }
    }
}